norm binom pois exp gamma t chisq (type ?distributions in Console to see more)r on front of these; inputs are number of random values to generate, and parameters of distribution to simulate from.and
To simulate many times: - set up dataframe with space for each simulated value - work rowwise - do one simulation per row
Make a bar chart rather than a histogram because distribution of \(Z\) is discrete:
Only this much:
A sum of 5 is possible though very unlikely.
Source: Hesterberg et al
[1] 14184 14433 15062 15086 15168 15606 16402 17264 17276 18581 19014 19217
[13] 21195 21312 21397 21519 29306 30430 33086 34743 37929 42419 42917 44794
[25] 48414
[1] 14184 14433 14433 15086 15086 15168 15168 16402 17264 17264 17276 17276
[13] 17276 17276 18581 19014 21312 21519 33086 37929 42419 42419 42917 42917
[25] 48414
[1] 23764.76
tibble(sim = 1:10000) %>%
rowwise() %>%
mutate(boot_sample = list(sample(jays$attendance, replace = TRUE))) %>%
mutate(my_mean = mean(boot_sample)) -> samples
sampleslist because we are saving the whole sample in one cell of the dataframe)might be better than a histogram: